import http from '@/utils/request.js';

// 工单计划表
export const getPlanList = (data) => {
	// return http.post('/repair/maintain/plan/content/plan/order/home/page', data,1);
	return http.request({
		url: '/repair/maintain/plan/content/plan/order/home/page',
		method: 'post',
		data,
		textJson: 1,
	});
};

// 工单计划表 v3
export const getPlanListV3 = (data) => {
	// return http.post('/repair/maintain/plan/content/plan/order/home/page/v3', data, 1);
	return http.request({
		url: '/repair/maintain/plan/content/plan/order/home/page/v3',
		method: 'post',
		data,
		textJson: 1,
	});
};
// 任务详情工作项
export const getWorkOredrDetail = (data) => {
	// return http.get('/repair/maintain/plan/content/work/item', data);
	return http.request({
		url: '/repair/maintain/plan/content/work/item',
		method: 'get',
		data,
	});
};

// 关联配件任务
export const getWorkPartList = (data) => {
	// return http.get('/repair/maintain/malfunction/work/getPartList', data);
	return http.request({
		url: '/repair/maintain/malfunction/work/getPartList',
		method: 'get',
		data,
	});
};
// 任务详情工作项 预览
export const getWorkOredrDetailPreview = (data) => {
	// return http.get('/repair/maintain/plan/content/work/item/preview', data);
	return http.request({
		url: '/repair/maintain/plan/content/work/item/preview',
		method: 'get',
		data,
	});
};

// 任查看所有工作项
export const getAllWorkItems = (data) => {
	// return http.get('/repair/maintain/plan/content/work/item/list', data);
	return http.request({
		url: '/repair/maintain/plan/content/work/item/list',
		method: 'get',
		data,
	});
};

// 工作项分类
export const getLoaclTypes = (data) => {
	// return http.get('/repair/maintain/plan/content/location/type', data);
	return http.request({
		url: '/repair/maintain/plan/content/location/type',
		method: 'get',
		data,
	});
};
// 工作项分类 预览
export const getLoaclTypesPreview = (data) => {
	// return http.get('/repair/maintain/plan/content/location/type/preview', data);
	return http.request({
		url: '/repair/maintain/plan/content/location/type/preview',
		method: 'get',
		data,
	});
};
// 获取任务详状态详情(完成时间,是否时间)
export const getPlanDetail = (data) => {
	// return http.get('/repair/maintain/plan/content/detail', data);
	return http.request({
		url: '/repair/maintain/plan/content/detail',
		method: 'get',
		data,
	});
};

// 签到
export const signIn = (data) => {
	// return http.post('/repair/maintain/sign/in', data, 1);
	return http.request({
		url: '/repair/maintain/sign/in',
		method: 'post',
		data,
		textJson: 1,
	});
};

// 签退
export const signOut = (data) => {
	// return http.post('/repair/maintain/sign/out', data, 1);
	return http.request({
		url: '/repair/maintain/sign/out',
		method: 'post',
		data,
		textJson: 1,
	});
};

// 工作项修改
export const workItemUpdate = (data) => {
	// return http.post('/repair/maintain/check/history/update', data, 1);
	return http.request({
		url: '/repair/maintain/check/history/update',
		method: 'post',
		data,
		textJson: 1,
	});
};
// 工作项修改
export const workItemsUpdate = (data) => {
	// return http.post('/repair/maintain/check/history/update/batch', data, 1);
	return http.request({
		url: '/repair/maintain/check/history/update/batch',
		method: 'post',
		data,
		textJson: 1,
	});
};

// 新增/编辑操作记录
export const editCHeckRecord = (data) => {
	// return http.post('/repair/maintain/check/history/add/check/record', data, 1);
	return http.request({
		url: '/repair/maintain/check/history/add/check/record',
		method: 'post',
		data,
		textJson: 1,
	});
};

// 提交任务（完成

export const finishPlan = (data) => {
	// return http.post('/repair/maintain/plan/content/commit', data, 1);
	return http.request({
		url: '/repair/maintain/plan/content/commit',
		method: 'post',
		data,
		textJson: 1,
	});
};

// 获取签字列表
export const signatureList = (data) => {
	// return http.get('/repair/maintain/plan/content/list/signature', data);
	return http.request({
		url: '/repair/maintain/plan/content/list/signature',
		method: 'get',
		data,
	});
};

// 签字
export const signaturePlan = (data) => {
	// return http.post('/repair/maintain/plan/content/signture', data, 1);
	return http.request({
		url: '/repair/maintain/plan/content/signture',
		method: 'post',
		data,
		textJson: 1,
	});
};

// 获取部件更换详情
export const getPartsDetail = (data) => {
	// return http.get('/maintain/parts/work/detail', data);
	return http.request({
		url: '/maintain/parts/work/detail',
		method: 'get',
		data,
	});
};

// 获取审批任务 流程条
export const getPlanStep = (data) => {
	// return http.get('/blade-flow/parts/history-flow-list', data);
	return http.request({
		url: '/blade-flow/parts/history-flow-list',
		method: 'get',
		data,
	});
};

// 任务审批
export const appRovePlan = (data) => {
	// return http.post('/blade-flow/work/complete-task', data, 1);
	return http.request({
		url: '/blade-flow/work/complete-task',
		method: 'post',
		data,
		textJson: 1,
	});
};

// 任务审批
export const partsApprove = (data) => {
	return http.request({
		url: '/repair/business/flow/5/approve',
		method: 'post',
		data,
		textJson: 1,
	});
};

// 催办
export const pressPlan = (data) => {
	// return http.post('/blade-flow/parts/reminder', data);
	return http.request({
		url: '/blade-flow/parts/reminder',
		method: 'post',
		data,
	});
};

// 催办-新
export const pressPlanNew = (data) => {
	return http.request({
		url: '/repair/business/flow/5/reminder?businessApproveId=' + data.businessApproveId,
		method: 'post',
		data,
		textJson: 1,
	});
};

// 撤回
export const withdrawalPlanNew = (data) => {
	return http.request({
		url: '/repair/business/flow/5/cancel?businessApproveId=' + data.businessApproveId,
		method: 'post',
		data,
		textJson: 1,
	});
};

// 撤回
export const withdrawalPlan = (data) => {
	// return http.post('/blade-flow/parts/cancel', data);
	return http.request({
		url: '/blade-flow/parts/cancel',
		method: 'post',
		data,
	});
};
// 完成配件工单
export const finishwPartOrder = (data) => {
	// return http.post('/maintain/parts/work/finish', data, 1);
	return http.request({
		url: '/maintain/parts/work/finish',
		method: 'post',
		data,
		textJson: 1,
	});
};

// 配件部件更换详情
export const getPartList = (data) => {
	// return http.get('/maintain/parts/work/detail', data);
	return http.request({
		url: '/maintain/parts/work/detail',
		method: 'get',
		data,
	});
};

// 作业明细详情-保养
export const orderReordBy = (data) => {
	// return http.post('/repairCheck/user/plan/history/by', data, 1);
	return http.request({
		url: '/repairCheck/user/plan/history/by',
		method: 'post',
		data,
		textJson: 1,
	});
};
// 作业明细详情-维修
export const orderReordWx = (data) => {
	// return http.post('/repairCheck/user/plan/history/repair', data, 1);
	return http.request({
		url: '/repairCheck/user/plan/history/repair',
		method: 'post',
		data,
		textJson: 1,
	});
};
// 作业明细详情-配件
export const orderReordPj = (data) => {
	// return http.post('/repairCheck/user/plan/history/pj', data, 1);
	// 判断客户是否可以签字
	return http.request({
		url: '/repairCheck/user/plan/history/pj',
		method: 'post',
		data,
		textJson: 1,
	});
};
export const isCustomCanSign = (data) => {
	// return http.get('/repair/maintain/plan/content/signture/estate/status', data);
	return http.request({
		url: '/repair/maintain/plan/content/signture/estate/status',
		method: 'get',
		data,
	});
};

// 客户签字提交接口
export const customSign = (data) => {
	// return http.post('/repair/maintain/plan/content/signture/estate', data, 1);
	return http.request({
		url: '/repair/maintain/plan/content/signture/estate',
		method: 'post',
		data,
		textJson: 1,
	});
};

// 获取及时性
export const timeLiness = (data) => {
	// return http.get('/repair/maintain/plan/content/timeliness', data);
	return http.request({
		url: '/repair/maintain/plan/content/timeliness',
		method: 'get',
		data,
	});
};

// 获取任务时长
export const duration = (data) => {
	// return http.get('/repair/maintain/plan/content/duration', data);
	return http.request({
		url: '/repair/maintain/plan/content/duration',
		method: 'get',
		data,
	});
};

// 获取签到签退
export const signType = (data) => {
	// return http.get('/repair/maintain/plan/content/sign/type', data);
	return http.request({
		url: '/repair/maintain/plan/content/sign/type',
		method: 'get',
		data,
	});
};

// 任务追踪-计划执行人
export const getPlandUser = (data) => {
	// return http.get('/repair/maintainPlanContentUser/list/v2', data);
	return http.request({
		url: '/repair/maintainPlanContentUser/list/v2',
		method: 'get',
		data,
	});
};

// 作业明细详情-保养
export const orderReordByOld = (data) => {
	// return http.post('/repairCheck/user/plan/history/by/skip', data, 1);
	return http.request({
		url: '/repairCheck/user/plan/history/by/skip',
		method: 'post',
		data,
		textJson: 1,
	});
};
// 作业明细详情-维修
export const orderReordWxOld = (data) => {
	// return http.post('/repairCheck/user/plan/history/wx', data, 1);
	return http.request({
		url: '/repairCheck/user/plan/history/wx',
		method: 'post',
		data,
		textJson: 1,
	});
};
// 作业明细详情-配件
export const orderReordPjOld = (data) => {
	// return http.post('/repairCheck/user/plan/history/pj/skip', data, 1);
	// 判断客户是否可以签字
	return http.request({
		url: '/repairCheck/user/plan/history/pj/skip',
		method: 'post',
		data,
		textJson: 1,
	});
};

// 工单离线签到同步
export const offLineSignIn = (data) => {
	// return http.post('/repair/maintain/sign/offline/sign', data, 1, false);
	return http.request({
		url: '/repair/maintain/sign/offline/sign',
		method: 'post',
		data,
		textJson: 1,
		autoid: false,
	});
};

// **************** (事务-质检--救援) ****************
// 个人工单
export const getUserWorksPlan = (data) => {
	// return http.post('/sida-maintain-repair/maintainplanaffair/list', data, 1);
	return http.request({
		url: '/sida-maintain-repair/maintainplanaffair/list',
		method: 'post',
		data,
		textJson: 1,
	});
};
// 维保历史
export const getUserlistPlan = (data) => {
	// return http.post('/sida-maintain-repair/maintainplanaffair/elevator/list', data, 1);
	return http.request({
		url: '/sida-maintain-repair/maintainplanaffair/elevator/list',
		method: 'post',
		data,
		textJson: 1,
	});
};

// 是否是质检整改维修任务
export const getIsCheckPlan = (data) => {
	// return http.get('/repair/maintain/malfunction/work/isCheckPlan', data);
	return http.request({
		url: '/repair/maintain/malfunction/work/isCheckPlan',
		method: 'get',
		data,
	});
};

// 同步离线数据 
export const postSyncData = (data) => {
	// return http.post('/repair/maintain/plan/content/by/offline/update', data, 1, false);
	return http.request({
		url: '/repair/maintain/plan/content/by/offline/update',
		method: 'post',
		data,
		textJson: 1,
		autoid: false,
	});
};

// 备份离线数据到服务端 
export const backupSyncData = (data) => {
	// return http.post('/repair/maintain/plan/content/by/offline/data/save', data, 1, false);
	return http.request({
		url: '/repair/maintain/plan/content/by/offline/data/save',
		method: 'post',
		data,
		textJson: 1,
		autoid: false,
	});
};

// 配件工单-撤回申请 query：planId
export const withdrawalPartsPlan = (data) => {
	// return http.post('/maintain/parts/work/cancel/apply', data);
	return http.request({
		url: '/maintain/parts/work/cancel/apply',
		method: 'post',
		data,
	});
};

// 保养工单备注列表
export const getPlanLogs = (data) => {
	// return http.get('/check/error/log/list', data);
	return http.request({
		url: '/check/error/log/list',
		method: 'get',
		data,
	});
};

// 添加或编辑工单备注 
export const setPlanLog = (data) => {
	// return http.post('/check/error/log/submit', data, 1);
	return http.request({
		url: '/check/error/log/submit',
		method: 'post',
		data,
		textJson: 1,
	});
};

// 删除工单备注 ids 逗号隔
export const removePlanLogs = (data) => {
	// return http.del('/check/error/log/remove', data);
	return http.request({
		url: '/check/error/log/remove',
		method: 'DELETE',
		data,
	});
};
